<?php
    session_start();

	include("connect.php");
	if ($txtnewpass != $txtconfirm) {
		echo " <SCRIPT> alert(\"Password baru anda tidak sama !\") </SCRIPT> ";
		echo "<meta http-equiv=\"refresh\" content=\"0; url=studentpage.php\">";
		echo "Klik <a href=\"studentpage.php\">disini</a> apabila browser anda berhenti berjalan ...";
		exit;
	}
	$pilih=mysql_select_db("uwika_krs",$conn);
	$sqlstr="select password from security where username='$reg_uname'";
	$hasil=mysql_query($sqlstr);
	list($passlama) = mysql_fetch_row($hasil);
	if ($passlama != $txtoldpass) {
		echo " <SCRIPT> alert(\"Password lama anda salah !\") </SCRIPT> ";
	} else {
		$sqlstr="update security set password = '$txtnewpass' where username='$reg_uname'";
		$hasil=mysql_query($sqlstr);
		echo " <SCRIPT> alert(\"Penggantian password berhasil !\") </SCRIPT> ";
	}
	echo "<meta http-equiv=\"refresh\" content=\"0; url=studentpage.php\">";
	echo "Klik <a href=\"studentpage.php\">disini</a> apabila browser anda berhenti berjalan ...";
?>